{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. _nb_nelder_mead:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Nelder Mead\n",
    "\n",
    "\n",
    "This algorithm is implemented based on <cite data-cite=\"NelderMead65\"></cite>. In addition to other implementations, a boundary check is included. This ensures that the search considers the box constraints of the given optimization problem. If no boundaries are provided the algorithm falls back to a search without any constraints. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "code": "algorithms/usage_nelder_mead.py"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Best solution found: \n",
      "X = [0.49977236 0.49995608 0.50006502 0.50014803 0.50029494 0.50009887\n",
      " 0.4992701  0.49963783 0.49968202 0.49961358]\n",
      "F = [1.09100991e-06]\n"
     ]
    }
   ],
   "source": [
    "from pymoo.algorithms.so_nelder_mead import NelderMead\n",
    "from pymoo.factory import get_problem\n",
    "from pymoo.optimize import minimize\n",
    "\n",
    "problem = get_problem(\"sphere\")\n",
    "\n",
    "algorithm = NelderMead()\n",
    "\n",
    "res = minimize(problem,\n",
    "               algorithm,\n",
    "               seed=1,\n",
    "               verbose=False)\n",
    "\n",
    "print(\"Best solution found: \\nX = %s\\nF = %s\" % (res.X, res.F))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### API"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. autoclass:: pymoo.algorithms.so_nelder_mead.NelderMead\n",
    "    :noindex:"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Raw Cell Format",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
